package cn.lh.entity.req;

import cn.lh.entity.dto.OrderDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @描述:
 * @版权: Copyright (c): 2025
 * @作者: linhong
 * @创建日期: 2025/04/16
 */
@Data
public class OrderReq {

    @ApiModelProperty(value = "id 修改时必传" )
    private Integer orderId;

    @ApiModelProperty(value = "产品id" ,required = true)
    @NotNull(message = "产品id不能为空")
    private Integer productId;

    @ApiModelProperty(value = "快递单号",required = true )
    @NotEmpty(message = "快递单号不能为空")
    private String expressNumber;

    @ApiModelProperty(value = "收价" ,required = true)
    @NotNull(message = "收价不能为空")
    private BigDecimal buyPrice;

    @ApiModelProperty(value = "数量" ,required = true)
    @NotNull(message = "数量不能为空")
    private Integer number;

    @ApiModelProperty(value = "报单日期" ,example = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date reportDate;

    @ApiModelProperty(value = "出价" ,required = true)
    @NotNull(message = "出价不能为空")
    private BigDecimal sellPrice;

    @ApiModelProperty(value = "快递费" ,required = true)
    @NotNull(message = "快递费不能为空")
    private BigDecimal expressPrice;

    @ApiModelProperty(value = "是否结账   0: 未结账 1: 结账",required = true )
    @NotNull(message = "是否结账不能为空")
    private Integer status;

    @ApiModelProperty(value = "备注" )
    private String remark;

    @ApiModelProperty(value = "地址" )
    private String address;

    @ApiModelProperty(value = "联系人" )
    private String contacts;


    public OrderDto toDto(){
        OrderDto order = new OrderDto();
        order.setId(orderId);
        order.setProductId(productId);
        order.setExpressNumber(expressNumber);
        order.setBuyPrice(buyPrice);
        order.setNumber(number);
        order.setReportDate(reportDate);
        order.setSellPrice(sellPrice);
        order.setExpressPrice(expressPrice);
        order.setStatus(status);
        order.setRemark(remark);
        order.setAddress(address);
        order.setContacts(contacts);
        return order;
    }

}
